﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Automted_Bank_teller
{
   public class Withdrawls_Process : DatabaseConnection
    {
        public static float money_after_widthdrawls; //to keep in it the money after witgdrawls is done 
        public static float input_money; //money client enter it to withdrawls from totlal money

        public void SelectCurrentBalance()
        {
            cmd.CommandText = "Select balance From Clients Where client_id='" + global_var.G_Client_ID + "'and pin_code='" + global_var.G_Client_PIN_Code + "'";

        }

        public void GetCurrentBalance()
        {

            SqlDataReader Selector = cmd.ExecuteReader();
            if (Selector.Read())
            {
                global_var.G_Current_Account_balance =float.Parse(Selector.GetValue(0).ToString());
                //money_after_widthdrawls = global_var.G_Current_Account_balance - input_money;
                
            }
        }
       
    

        public void UpdateAccountBalaceAfterWithdrawls()
        {
            cmd.CommandText = "Update Clients Set balance ='" + money_after_widthdrawls + "'Where client_id='" + global_var.G_Client_ID + "'and pin_code='" + global_var.G_Client_PIN_Code + "' ";
        }


        public void ExecuteQuery()
        {
            cmd.ExecuteNonQuery();
        }








    }
}
